home *** CD-ROM | disk | FTP | other *** search
- #include "out.h"
-
- void createColorScale()
- {
- int i;
- int x;
- int down = true;
- int index = 8;
-
- PenSize( 14, 1 );
-
- for (x = -420; x < 420; x += 105)
- {
- for (i = 0; i < 30; i++)
- {
- setColor( index );
-
- if (down == true)
- drawLine( x, 420 - (i * 28) , x, 420 - ((i + 1) * 28) );
- else
- drawLine( x, -420 + (i * 28) , x, -420 + ((i + 1) * 28) );
- index++;
- }
-
- down = 1 - down;
- }
-
- down = false;
- index = 8;
-
- for (x = 368; x > -472; x -= 105)
- {
- for (i = 0; i < 30; i++)
- {
- setColor( index );
-
- if (down == true)
- drawLine( x, 420 - (i * 28) , x, 420 - ((i + 1) * 28) );
- else
- drawLine( x, -420 + (i * 28) , x, -420 + ((i + 1) * 28) );
- index++;
- }
-
- down = 1 - down;
- }
- }
-
- void createColorWheels()
- {
- testTriangle( -400, 300 );
- testTriangle( 400, 300 );
- testTriangle( 400, -300 );
- testTriangle( -400, -300 );
- shadeWasher( 0, 0, 360, 80 );
- }
-
- void createColorRings()
- {
- shadeWasher( 0, 0, 500, 400 );
- shadeWasher( 0, 0, 400, 300 );
- shadeWasher( 0, 0, 300, 200 );
- shadeWasher( 0, 0, 200, 100 );
- }
-
- void createColorGears()
- {
- shadeWasher( 150, 150, 300, 100 );
- shadeWasher( -150, 150, 300, 100 );
- shadeWasher( -150, -150, 300, 100 );
- shadeWasher( 150, -150, 300, 100 );
- }
-
- void createColorCurves()
- {
- shadeWasher( 720, 720, 900, 0 );
- shadeWasher( 720, -720, 900, 0 );
- shadeWasher( -720, -720, 900, 0 );
- shadeWasher( -720, 720, 900, 0 );
- shadeWasher( 0, 0, 400, 0 );
- }
-
- void createColorBalls()
- {
- int x, y;
-
- for (x = -432; x <= 432; x += 108)
- for (y = -432; y <= 432; y += 108)
- shadeWasher( x, y, 60, 0 );
- }
-
- void createColorWave()
- {
- shadeSCurve( -300, 250, 210, 60, 9 );
- shadeSCurve( 96, 250, 210, 60, 69 );
- shadeSCurve( -300, 150, 210, 60, 129 );
- shadeSCurve( 96, 150, 210, 60, 189 );
- shadeSCurve( -300, 50, 210, 60, 9 );
- shadeSCurve( 96, 50, 210, 60, 69 );
- shadeSCurve( -300, -50, 210, 60, 129 );
- shadeSCurve( 96, -50, 210, 60, 189 );
- shadeSCurve( -300, -150, 210, 60, 9 );
- shadeSCurve( 96, -150, 210, 60, 69 );
- shadeSCurve( -300, -250, 210, 60, 129 );
- shadeSCurve( 96, -250, 210, 60, 189 );
- }
-
- void createColorText()
- {
- Rect rect;
- PicHandle thePict;
- int width, height;
-
- thePict = (PicHandle)GetResource( 'PICT', 129 );
-
- width = (**thePict).picFrame.right - (**thePict).picFrame.left;
- height = (**thePict).picFrame.bottom - (**thePict).picFrame.top;
-
- SetRect( &rect, (WWIDTH - width) / 2, (WHEIGHT - height) / 2,
- ((WWIDTH - width) / 2) + width, ((WHEIGHT - height) / 2 ) + height );
-
- DrawPicture( thePict, &rect );
- ReleaseResource( thePict );
- }
-
- drawColorSpheres()
- {
- int rad;
- int i;
-
- for (i = 9; i < 48; i++)
- {
- setColor( i );
- rad = (48 - i) * 3;
- drawCircle( (int)(i * 1.414), (int)(i * 1.414), rad );
- }
- }
-
- void testTriangle( x, y )
- int x, y;
- {
- PenSize( 1, 1 );
-
- setColor( 7 );
- drawCircle( x, y, 25 );
-
- setColor( 1 );
- drawWasher( x, y, 25, 60, -30, 30 );
- drawLine( x - 60, y + 40, x, y + 140 );
- drawLine( x, y + 140, x + 60, y + 40 );
- setColor( 2 );
- drawWasher(x, y, 25, 60, 30, 90 );
- setColor( 3 );
- drawWasher(x, y, 25, 60, 90, 150 );
- drawLine( x + 60, y + 40, x + 121, y - 70 );
- drawLine( x + 121, y - 70, x, y - 70 );
- setColor( 4 );
- drawWasher( x, y, 25, 60, 150, 210 );
- setColor( 5 );
- drawWasher( x, y, 25, 60, 210, 270 );
- drawLine( x - 60, y + 40, x - 121, y - 70 );
- drawLine( x - 121, y - 70, x, y - 70 );
- setColor( 6 );
- drawWasher( x, y, 25, 60, 270, 330 );
- }
-
- void shadeWasher( x, y, radout, radin )
- int x, y;
- int radout, radin;
- {
- int ang;
- int i = 8;
- int radmid;
-
- radmid = radin + (radout - radin) / 2;
-
- for (ang = 0; ang < 360; ang += 3)
- {
- setColor( i );
- drawWasher( x, y, radmid, radout, ang, ang + 3 );
- i++;
- }
-
- for (ang = 0; ang < 360; ang += 3)
- {
- setColor( i );
- drawWasher( x, y, radin, radmid, ang, ang + 3 );
- i++;
- }
- }
-
- shadeSCurve( x, y, radout, radin, index )
- int x, y;
- int radout, radin;
- int index;
- {
- int ang;
-
- for (ang = 270; ang > 90; ang -= 6)
- {
- setColor( index );
- drawWasher( x, y, 60, 210, ang, ang - 6 );
- index++;
- }
-
- for (ang = -90; ang < 90; ang += 6)
- {
- setColor( index );
- drawWasher( x + 198, y, 60, 210, ang, ang + 6 );
- index++;
- }
- }
-
- void translate( x, y )
- int *x, *y;
- {
- int xx, yy;
-
- xx = *x / SCALE;
- yy = *y / SCALE;
-
- *x = xx + (WWIDTH / 2);
- *y = (-yy) + (WHEIGHT / 2);
- }
-
- void scale( len )
- int *len;
- {
- *len /= SCALE;
- }
-
- void drawCircle( x, y, radius )
- int x, y;
- int radius;
- {
- Rect rect;
- int foo = 0;
-
- translate( &x, &y );
- scale( &radius );
-
- SetRect( &rect, x - radius, y - radius, x + radius, y + radius );
- PaintOval( &rect );
- }
-
- void drawWasher( x, y, irad, orad, sang, eang )
- int x, y;
- int irad, orad;
- int sang, eang;
- {
- int width;
- Rect rect;
-
- translate( &x, &y );
- scale( &irad );
- scale( &orad );
-
- width = (orad - irad) / 2;
-
- PenSize( width, width );
- SetRect( &rect, x - (irad + width), y - (irad + width),
- x + (irad + width), y + (irad + width) );
-
- FrameArc( &rect, sang, eang - sang );
- PenSize( 1, 1 );
- }
-
- void drawLine( sx, sy, ex, ey )
- {
- translate( &sx, &sy );
- translate( &ex, &ey );
-
- MoveTo( sx, sy );
- LineTo( ex, ey );
- }